<?php

/**
 * Boleta filter form base class.
 *
 * @package    aeropostal
 * @subpackage filter
 * @author     Your name here
 */
abstract class BaseBoletaFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'fecha'             => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'factura'           => new sfWidgetFormPropelChoice(array('model' => 'Factura', 'add_empty' => true)),
      'vuelo'             => new sfWidgetFormPropelChoice(array('model' => 'Vuelo', 'add_empty' => true)),
      'estacionSum'       => new sfWidgetFormPropelChoice(array('model' => 'Estacion', 'add_empty' => true)),
      'compania'          => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'aeronave'          => new sfWidgetFormPropelChoice(array('model' => 'Aeronave', 'add_empty' => true)),
      'uMedida'           => new sfWidgetFormPropelChoice(array('model' => 'Unidmedida', 'add_empty' => true)),
      'tipoComb'          => new sfWidgetFormPropelChoice(array('model' => 'Tipocomb', 'add_empty' => true)),
      'lecturaI'          => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'lecturaF'          => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'total'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'cantNacional'      => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'cantInternacional' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'horaI'             => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'horaF'             => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'horaTotal'         => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'estatus'           => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'fecha'             => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'factura'           => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Factura', 'column' => 'numero')),
      'vuelo'             => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Vuelo', 'column' => 'numVuelo')),
      'estacionSum'       => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Estacion', 'column' => 'codigo')),
      'compania'          => new sfValidatorPass(array('required' => false)),
      'aeronave'          => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Aeronave', 'column' => 'serial')),
      'uMedida'           => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Unidmedida', 'column' => 'simbolo')),
      'tipoComb'          => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Tipocomb', 'column' => 'nombre')),
      'lecturaI'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'lecturaF'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'total'             => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'cantNacional'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'cantInternacional' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'horaI'             => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'horaF'             => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'horaTotal'         => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'estatus'           => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('boleta_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Boleta';
  }

  public function getFields()
  {
    return array(
      'proveedor'         => 'ForeignKey',
      'fecha'             => 'Date',
      'numBoleta'         => 'Text',
      'factura'           => 'ForeignKey',
      'vuelo'             => 'ForeignKey',
      'estacionSum'       => 'ForeignKey',
      'compania'          => 'Text',
      'aeronave'          => 'ForeignKey',
      'uMedida'           => 'ForeignKey',
      'tipoComb'          => 'ForeignKey',
      'lecturaI'          => 'Number',
      'lecturaF'          => 'Number',
      'total'             => 'Number',
      'cantNacional'      => 'Number',
      'cantInternacional' => 'Number',
      'horaI'             => 'Date',
      'horaF'             => 'Date',
      'horaTotal'         => 'Date',
      'estatus'           => 'Text',
    );
  }
}
